<%--
  Created by IntelliJ IDEA.
  User: Rui
  Date: 2018/10/25
  Time: 16:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="../../../resources/inc/head.jsp" %>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="Type-serch">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table id="customerRequirementManage" lay-filter="customerRequirementManage"></table>
            <script type="text/html" id="optionToolbar">
                <div class="layui-btn-container">
<%--                        <button class="layui-btn layui-btn-sm" lay-event="add">新增  </button>--%>
<%--                        <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="dels"id="dels">批量删除</button>--%>

                </div>
            </script>
            <script type="text/html" id="optionBar">
<%--                    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>--%>
<%--                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>--%>
            </script>
            <script type="text/html" id="gmtModifiedTpl">
                {{#
                var date = new Date();
                date.setTime(d.gmtModified);
                return date.Format("yyyy-MM-dd hh:mm:ss");
                }}
            </script>
            <script type="text/html" id="category">
                {{d.category.title
                }}
            </script>
            <script type="text/html" id="isDisabledTpl">
                <input type="checkbox" name="state" value="{{d.id}}" title="禁用" lay-filter="isDisabledFilter" {{
                       d.state== 1 ? 'checked' : '' }}>
            </script>
            <script type="text/html" id="type">
            {{d.contentCategory.name}}
            </script>
            <script type="text/html" id="photo">

                <div><img src="{{d.photo==null?'<%=basePath%>resources/images/noImage.jpg':d.photo}}" style="height: 28px" class="layui-table-link"></div>
            </script>
        </div>
    </div>
</div>

<%@include file="../../../resources/inc/footer.jsp" %>
<script>
    layui.config({
        base: '<%=basePath%>resources/lib/layuiAdmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table;
    table.render({
            elem: '#customerRequirementManage',
            url: '<%=basePath%>manager/customer/requirement/list.action',
            toolbar: '#optionToolbar',
            cols: [[
                {type: 'checkbox',fixed:'left'},
                {field: 'id', width: 60, title: 'ID', sort: true}
                , {field: 'name', title: '姓名'}
                , {field: 'phone', title: '手机号'}
                , {field: 'category', title: '类型',templet: "#category"}
                , {field: 'description', title: '描述'}
                , {title: '更新时间',width: 200, sort: true, templet: "#gmtModifiedTpl"}

            ]],
            page: !0,
            limit: 10,
            height: "full-130",
            text: {none:"暂无可显示数据"},
            response: {
                statusCode: 200
            }
        });


        //监听搜索
        form.on('submit(Type-serch)', function (data) {
            var field = data.field;
            $(".layui-laypage-skip").find("input").val("1");
            $(".layui-laypage-btn").click();

            table.reload('customerRequirementManage', {
                where: {name:field.name,language:field.language}
            });
        });


    });
    function edit(e) {

    }

</script>
</body>
</html>

